package com.gewu.pm.utils;


import com.blankj.utilcode.util.SPUtils;

import java.util.Set;

/**
 * 存储类
 */
public class CacheUtils {
    /**
     * 存储类
     */
    private static final String FILE_NAME = "data_goChoose";

    /**
     * 获取sp工具类
     */
    public static SPUtils getSPUtils() {
        return SPUtils.getInstance(FILE_NAME);
    }

    public static void removeSPUtils(){
        getSPUtils().remove("roleId");
    }

    public static boolean isToLogin() {
        return getSPUtils().getBoolean("isToLogin", false);
    }

    //获取登录状态
    public static void setToLogin(boolean isLogin) {
        getSPUtils().put("isToLogin", isLogin);
    }

    public static void setToken(String token){
        getSPUtils().put("token",token);
    }
    public static String getToken(){
        return getSPUtils().getString("token","");
    }

    public static void setTokenName(String tokenName){
        getSPUtils().put("tokenName",tokenName);
    }
    public static String getTokenName(){
        return getSPUtils().getString("tokenName","");
    }

    //当前权限
    public static void setUserRights(Set<String> rights){
        getSPUtils().put("rights", rights);
    }
    public static Set<String> getUserRights(){
        return getSPUtils().getStringSet("rights");
    }

    //登录名
    public static void setUserName(String userName){
        getSPUtils().put("userName", userName);
    }
    public static String getUserName(){
        return getSPUtils().getString("userName","");
    }
    //登录ID
    public static void setUserId(int userId){
        getSPUtils().put("userId",userId);
    }
    public static int getUserId(){
        return getSPUtils().getInt("userId",0);
    }

    //加盟商ID
    public static void setAllianceId(int allianceId){
        getSPUtils().put("allianceId",allianceId);
    }
    public static int getAllianceId(){
        return getSPUtils().getInt("allianceId",0);
    }

    //大区ID
    public static void setRegionId(int regionId){
        getSPUtils().put("regionId",regionId);
    }
    public static int getRegionId(){
        return getSPUtils().getInt("regionId",0);
    }

    //用户类型，-2：admin，-1：系统角色，0：大区管理员，1：加盟商，2区域管理员 3 运维员
    public static void setUserType(int userType){
        getSPUtils().put("userType",userType);
    }
    public static int getUserType(){
        return getSPUtils().getInt("userType",0);
    }

    //获取极光推送id
    public static void setPushId(String regId){
        getSPUtils().put("regId",regId);
    }

    public static String getPushId(){
        return getSPUtils().getString("regId","");
    }

    //当前登录人id
    public static void setCurrentId(int currentId){
        getSPUtils().put("currentId",currentId);
    }
    public static int getCurrentId(){
        return getSPUtils().getInt("currentId",0);
    }

    //登录人名称
    public static void setCurrentName(String operationName){
        getSPUtils().put("currentName",operationName);
    }
    public static String getCurrentName(){
        return getSPUtils().getString("currentName","");
    }

    //登录人手机号
    public static void setCurrentMobile(String operationPhone){
        getSPUtils().put("currentMobile",operationPhone);
    }
    public static String getCurrentMobile(){
        return getSPUtils().getString("currentMobile","");
    }

    //登录头像
    public static void setCurrentHeadImage(String headImage){
        getSPUtils().put("currentHeadImage",headImage);
    }
    public static String getCurrentHeadImage(){
        return getSPUtils().getString("currentHeadImage","");
    }

    //获取消息页指引状态
    public static boolean isOrderGuide() {
        return getSPUtils().getBoolean("isOrderGuide", true);
    }

    public static void setOrderGuide(boolean isOrderGuide) {
        getSPUtils().put("isOrderGuide", isOrderGuide);
    }
    //获取消息详情指引状态
    public static boolean isOrderDetailsGuide() {
        return getSPUtils().getBoolean("isOrderDetailsGuide", true);
    }

    public static void setOrderDetailsGuide(boolean isOrderDetailsGuide) {
        getSPUtils().put("isOrderDetailsGuide", isOrderDetailsGuide);
    }

    //获取车辆地图页指引状态
    public static boolean isVehicleGuide() {
        return getSPUtils().getBoolean("isVehicleGuide", true);
    }

    public static void setVehicleGuide(boolean isVehicleGuide) {
        getSPUtils().put("isVehicleGuide", isVehicleGuide);
    }
    //获取云仓页指引状态
    public static boolean isYunCangGuide() {
        return getSPUtils().getBoolean("isYunCangGuide", true);
    }

    public static void setYunCangGuide(boolean isYunCangGuide) {
        getSPUtils().put("isYunCangGuide", isYunCangGuide);
    }
    //获取个人中心指引状态
    public static boolean isMineGuide() {
        return getSPUtils().getBoolean("isMineGuide", true);
    }

    public static void setMineGuide(boolean isMineGuide) {
        getSPUtils().put("isMineGuide", isMineGuide);
    }
}
